<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script>
		function* foo(x) {
			var y = 2 * ( yield (x + 1));
			var z = yield (y / 3);
			return (x+y+z);
		}

		var a = foo(5);
		a.next(); // Object{value:6, done:false}
		a.next();	// Object{value:NaN, done:false}
		a.next();	// Object{value:NaN, done:true

		var b = foo(5);
		a.next(); // Object{value:6, done:false}
		a.next(12);	// Object{value:8, done:false}
		a.next(13);	// Object{value:42, done:true
	</script>
</head>
<body>
	
</body>
</html>